public class Demo09 {
    public static void main(String[] args) {
        Demo09Income[] incomes = new Demo09Income[]{
            new Demo09Salary(5000),
            new Demo09Salary(6000),
            new Demo09StateCouncilSpecialAllowance(5000)
        };
        System.out.println(totalTax(incomes));
    }

    public static double totalTax(Demo09Income... incomes) {
        double total = 0;
        for (Demo09Income income : incomes) {
            total += income.getTax();
        }
        return total;
    }
}
